# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>

pkgname=python-threat9-test-bed
_pyname=threat9-test-bed
_gitcommit=1ed61b34d0b138711e3f8267259cdb29787fe349
pkgver=0.6.0+2+g1ed61b3
pkgrel=9
pkgdesc='Threat9 Test Bed'
url='https://github.com/threat9/threat9-test-bed'
arch=('any')
license=('custom')
depends=('python' 'python-click' 'python-faker' 'python-flask'
         'python-asgiref' 'gunicorn' 'python-pyopenssl' 'python-requests')
makedepends=('git' 'python-build' 'python-installer' 'python-setuptools-scm' 'python-setuptools' 'python-wheel')
checkdepends=('python-pytest')
source=(${pkgname}::"git+https://github.com/threat9/threat9-test-bed#commit=${_gitcommit}"
        http-service-async-mock.patch)
sha512sums=('SKIP'
            '50ce00674dbf9878f09b27397af2f062fab8a71b11e66b49eb710876b49812ce95c93f4ee55bf1ad103b6f5d5b48b86c826a5adc2f9fddeb393ff6bddc650839')

pkgver() {
  cd ${pkgname}
  git describe --always --tags | sed 's/^v//;s/-/+/g'
}

prepare() {
  cd ${pkgname}
  # not sure why this works lol
  patch -Np1 -i ../http-service-async-mock.patch
}

build() {
  cd ${pkgname}
  python -m build --wheel --no-isolation
}

check() {
  cd ${pkgname}
  python -m pytest
}

package() {
  cd ${pkgname}
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm 644 README.md -t "${pkgdir}/usr/share/doc/${pkgname}"
}

# vim: ts=2 sw=2 et:
